<style lang="scss" scoped>
  .app-container {
    min-width: 1710px;
    overflow: auto;
    box-sizing: border-box;

    /*搜索区域*/
    .el-form {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      border-radius: 10px;
      background: #fff;
      box-shadow: 0px 20px 45px rgba(240, 237, 246, 0.5);
      padding: 10px 20px 0 20px;
      margin-bottom: 20px;

      .el-form-item {
        margin-bottom: 10px;

        ::v-deep .el-form-item__label {
          font-size: 14px;
          font-weight: 400;
          line-height: 32px;
          color: rgba(3, 2, 2, 1);
          text-align: right;
        }

        ::v-deep .el-form-item__content {

          .el-input {
            width: 165px;

            .el-input__inner {
              width: 165px;
              border: 1px solid rgba(127, 127, 213, 0.5);
              border-radius: 10px;
            }
          }

          .el-button {
            height: 32px;
            border-radius: 2px;
            background: linear-gradient(268.09deg, rgba(96, 103, 250, 1) 0%, rgba(119, 153, 252, 1) 100%);
            padding: 8px 18px;
            color: #fff;
            border: none;
            margin-left: 25px;

            &:hover {
              border: none;
              background: linear-gradient(268.09deg, rgb(69, 78, 255) 0%, rgb(88, 130, 255) 100%);
            }

            &:nth-child(1) {
              width: 60px;
              height: 32px;
              opacity: 1;
              border-radius: 2px;
              background: rgba(242, 243, 245, 1);
              color: rgba(0, 0, 0, 0.3);
              padding: 8px 16px;

              &:hover {
                border: none;
                background: rgb(228, 228, 228);
              }
            }
          }
        }
      }
    }

    /*第一行统计*/
    .row {
      display: flex;
      margin-bottom: 10px;
      /*第一行统计*/
      .col {
        display: flex;
        justify-content: space-around;
        align-items: center;
        width: 20%;
        height: 158px;
        border-radius: 10px;
        background: #fff;

        &:not(:last-child) {
          margin-right: 20px;
        }

        .col-r {
          .col-r-money {
            font-size: 24px;
            font-weight: 600;
            line-height: 28.13px;
            color: rgba(3, 2, 2, 1);
            text-align: right;
            margin-bottom: 10px;
          }

          .col-r-txt {
            font-size: 14px;
            font-weight: 400;
            color: rgba(188, 195, 212, 1);
            text-align: right;
          }
        }
      }

      .col-other {
        display: flex;
        flex-wrap: wrap;
        width: 20%;
        height: 158px;
        border-radius: 10px;
        background: #fff;

        .col-item {
          flex: 50%;
          display: flex;
          align-items: center;
          padding: 0 16px;
          box-sizing: border-box;

          .img-wrap {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 48px;
            height: 48px;
            border-radius: 6px;
            background: rgba(238, 242, 253, 1);
            margin-right: 6px;
          }

          .col-item-desc {
            .col-item-desc-num {
              font-size: 16px;
              font-weight: 700;
              color: rgba(94, 129, 244, 1);
              text-align: right;
              background: linear-gradient(to right, #6383F5, #D2AAFF); /* 从左到右渐变 */
              -webkit-background-clip: text; /* Safari/Chrome */
              -webkit-text-fill-color: transparent; /* Safari/Chrome */
              color: transparent; /* Firefox/Opera */
            }

            .col-item-desc-txt {
              font-size: 14px;
              color: rgba(188, 195, 212, 1);
              text-align: right;
            }
          }
        }
      }
    }

    .sec {
      display: flex;
      margin-bottom: 10px;

      .sec-l {
        width: 80%;
        background: #fff;
        border-radius: 10px;
        padding: 10px 20px;
        box-sizing: border-box;
        margin-right: 20px;

        .col-icon {
          display: flex;
          justify-content: space-between;
          margin-right: 20px;

          .col-icon-item {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;

            .img-wrap {
              width: 60px;
              height: 60px;
              margin-bottom: 10px;
              background: #D3FFF2;
              border-radius: 50%;
            }

            .col-icon-item-txt {
              margin-bottom: 10px;
              font-size: 16px;
              font-weight: 400;
              color: rgba(156, 159, 167, 1);
            }

            .col-icon-item-num {
              font-size: 32px;
              font-weight: 700;
              color: rgba(3, 2, 2, 1);
            }
          }
        }
      }

      .sec-r {
        width: 20%;
        height: 218px;
        padding: 10px 40px;
        box-sizing: border-box;
        background: #fff;
        border-radius: 10px;

        .entrance {
          display: flex;
          flex-wrap: wrap;

          .entrance-item {
            width: 110px;
            height: 44px;
            margin-bottom: 30px;
            line-height: 44px;
            text-align: center;
            border-radius: 2px;
            border: 1px solid rgba(209, 213, 229, 0.4);

            &:nth-child(2n + 1) {
              margin-right: 28px;
            }
          }

          .active {
            border: none;
            background: linear-gradient(268.09deg, rgba(96, 103, 250, 1) 0%, rgba(119, 153, 252, 1) 100%);
            color: #fff;
          }
        }
      }
    }

    .sale {
      background: #fff;
      border-radius: 10px;
      padding: 15px 30px;

      .title {
        display: flex;
        justify-content: space-between;
      }

      span {
        font-size: 24px;
        font-weight: 600;
        color: rgba(3, 2, 2, 1);
      }

      p {
        font-size: 18px;
        line-height: 28px;
        color: rgba(17, 38, 60, 1);
        border-left: 4px solid #545BF5;
      }

      .bar {
        .bar-item {
          display: flex;
          align-items: center;
          margin-bottom: 8px;

          .bar-con {
            flex: 1;

            ::v-deep.el-progress-bar__inner {
              text-align: left;
              padding-left: 8px;
              background: linear-gradient(to right, #7799FC, #6169FA);
            }
          }
        }
      }
    }

    .mb20 {
      margin-bottom: 20px;
    }

    /*第二行*/
    p {
      font-size: 18px;
      color: rgba(17, 38, 60, 1);
      text-align: left;
      border-left: 4px solid #545BF5;
      padding-left: 10px;
      margin-top: 0;
    }

    .pl0 {
      padding-left: 0 !important;
    }

    .pr0 {
      padding-right: 0 !important;
    }
  }
</style>
<template>
  <div class="app-container">
    <!--搜索区域-->
    <el-form size="small" :inline="true" label-width="70px">
      <el-form-item label="选择时间" prop="orderDate">
        <el-input/>
      </el-form-item>

      <el-form-item label="选择时间" prop="orderDate">
        <el-input/>
      </el-form-item>

      <el-form-item style="display: flex;">
        <el-button size="mini">重置</el-button>
        <el-button type="primary" size="mini">筛选</el-button>
        <el-button type="danger" size="mini">刷新</el-button>
      </el-form-item>
    </el-form>

    <!--第一行统计-->
    <div class="row">
      <div class="col">
        <div class="cor-l">
          <el-progress type="circle" :percentage="100" :stroke-width="10" color="#563BFF" define-back-color="#EFECFF"/>
        </div>
        <div class="col-r">
          <div class="col-r-money">￥{{count && count.dailySalesAmount }}</div>
          <div class="col-r-txt">今日销售金额</div>
        </div>
      </div>
      <div class="col">
        <div class="cor-l">
          <el-progress type="circle" :percentage="100" :stroke-width="10" color="#FF7049" define-back-color="#FFF3F0"/>
        </div>
        <div class="col-r">
          <div class="col-r-money">￥{{count && count.salesAmountFromThePreviousDay }}</div>
          <div class="col-r-txt">昨日销售金额</div>
        </div>
      </div>
      <div class="col">
        <div class="cor-l">
          <el-progress type="circle" :percentage="100" :stroke-width="10" color="#499DFF" define-back-color="#D2E7FF"/>
        </div>
        <div class="col-r">
          <div class="col-r-money">￥{{count && count.threedaySalesAmount  }}</div>
          <div class="col-r-txt">近三日销售金额</div>
        </div>
      </div>
      <div class="col">
        <div class="cor-l">
          <el-progress type="circle" :percentage="100" :stroke-width="10" color="#8F36FF" define-back-color="#F6ECFF"/>
        </div>
        <div class="col-r">
          <div class="col-r-money">￥{{count && count.getTotalSalesAmount  }}</div>
          <div class="col-r-txt">总成交金额</div>
        </div>
      </div>

      <div class="col-other">
        <div class="col-item">
          <div class="img-wrap">
            <img src="../../assets/images/dealtoday.png" style="width: 24px;height: 30px;"></div>
          <div class="col-item-desc">
            <div class="col-item-desc-num">{{threeWindow && threeWindow.singular}}次</div>
            <div class="col-item-desc-txt">今日成交数</div>
          </div>
        </div>
        <div class="col-item">
          <div class="img-wrap">
            <img src="../../assets/images/ratepay.png" style="width: 28px;height: 28px;"></div>
          <div class="col-item-desc">
            <div class="col-item-desc-num">{{threeWindow && threeWindow.percentage}}%</div>
            <div class="col-item-desc-txt">总成交数</div>
          </div>
        </div>
        <div class="col-item">
          <div class="img-wrap">
            <img src="../../assets/images/dealyestay.png" style="width: 28px;height: 28px;"></div>
          <div class="col-item-desc">
            <div class="col-item-desc-num">{{threeWindow && threeWindow.yestoday}}次</div>
            <div class="col-item-desc-txt">昨日成交数</div>
          </div>
        </div>
      </div>
    </div>

    <!--第二行统计-->
    <div class="sec">
      <div class="sec-l">
        <p>实时账号数据</p>
        <div class="col-icon">
          <div class="col-icon-item">
            <div class="img-wrap bg1">
              <img src="../../assets/images/分组 2.png" alt="">
            </div>
            <div class="col-icon-item-txt">今日异常已处理</div>
            <div class="col-icon-item-num">{{abnormalInformation && abnormalInformation.exceptionProcessedToday}}</div>
          </div>
          <div class="col-icon-item">
            <div class="img-wrap">
              <img src="../../assets/images/分组 3.png" alt="">
            </div>
            <div class="col-icon-item-txt">未售找回</div>
            <div class="col-icon-item-num">{{abnormalInformation && abnormalInformation.abnormalRetrievalInt}}</div>
          </div>
          <div class="col-icon-item">
            <div class="img-wrap">
              <img src="../../assets/images/分组 4.png" alt="">
            </div>
            <div class="col-icon-item-txt">已售找回</div>
            <div class="col-icon-item-num">{{abnormalInformation && abnormalInformation.discoveredInt}}</div>
          </div>
          <div class="col-icon-item">
            <div class="img-wrap">
              <img src="../../assets/images/分组 6.png" alt="">
            </div>
            <div class="col-icon-item-txt">已售未换绑</div>
            <div class="col-icon-item-num">{{abnormalInformation && abnormalInformation.soldButNotReboundInt}}</div>
          </div>
          <div class="col-icon-item">
            <div class="img-wrap">
              <img src="../../assets/images/分组 6.png" alt="">
            </div>
            <div class="col-icon-item-txt">已售异常</div>
            <div class="col-icon-item-num">{{abnormalInformation && abnormalInformation.abnormalsalesInt}}</div>
          </div>
          <div class="col-icon-item">
            <div class="img-wrap">
              <img src="../../assets/images/分组 6.png" alt="">
            </div>
            <div class="col-icon-item-txt">未售异常</div>
            <div class="col-icon-item-num">{{abnormalInformation && abnormalInformation.abnormalSalesCInt}}</div>
          </div>
        </div>
      </div>
      <div class="sec-r">
        <p style="margin-top: 15px;margin-bottom: 25px;">快捷入口</p>
        <div class="entrance">
          <div class="entrance-item active">员工提成</div>
          <div class="entrance-item">库存管理</div>
          <div class="entrance-item">借款报销</div>
          <div class="entrance-item">汇总报表</div>
        </div>
      </div>
    </div>

    <!--第三行-->
    <el-row :gutter="20" style="margin: 0;">
      <!--左侧-->
      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="pl0">
        <div class="sale">
          <p>号库总览</p>
          <div class="bar">
            <totalView v-if="pie.length > 0" id="2" :data="pie"/>
          </div>
        </div>
      </el-col>

      <!--右侧-->
      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="pr0">
        <div class="sale">
          <div class="title">
            <p>号库总价值</p>
            <span>1000</span>
          </div>
          <div class="bar">
            <div class="bar-item" v-for="item in 8">
              <div class="bar-con">
                <el-progress :text-inside="true" text-color="#fff" :stroke-width="28" :percentage="100"
                             define-back-color="transparent"/>
              </div>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
    import {getFinancialStatements,getcompletion,getcurrentAccountstatus,getLargeMarket} from "../../api/business/home.js";
    import totalView from "./components/totalView.vue";
    export default {
        components:{
            totalView
        },
        data() {
            return {
                count: {},
                threeWindow:{},
                abnormalInformation:{},
                pie: [],//饼图
            }
        },
        created() {
            getFinancialStatements().then(res => {
                this.count = res.data;
            });

            // 小窗口 三个字段
            getcompletion().then(res=>{
                this.threeWindow = res.data.Todaystransaction;
                this.threeWindow.yestoday = res.data.Yesterdaystransaction.singular;
            })

            // 实时账号
            getcurrentAccountstatus().then(res=>{
                this.abnormalInformation = res.data.abnormalInformation;
            });

            // 号库总览和号库价值
            getLargeMarket().then(res=>{
               this.pie  = res.data.marketPercentage.percentageChart;
            })
        },
        methods: {}
    }
</script>
